package com.bwie.task;

import com.bwie.mapper.TbProdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2025/6/25 16:54
 */

@Component
public class ProdTask {

    @Autowired
    TbProdMapper tbProdMapper;

    /**
     * @description 每分钟检查一次定时上架
     * @params []
     * @return void
     * @author 军哥
     * @date 2025/6/25 16:55
     */
    @Scheduled(cron = "0 0/1 * * * ?")
    public void uploadProdTask() {
        System.out.println("开始执行定时上架任务");
        tbProdMapper.taskUploadProd() ;
        System.out.println("结束执行定时下架任务");
    }

    /**
     * @description 定时下架商品：每分钟检查一次商品下架
     * @params []
     * @return void
     * @author 军哥
     * @date 2025/6/26 14:52
     */
    @Scheduled(cron = "0 0/1 * * * ?")
    public void offlineProdTask() {
        System.out.println("开始执行定时下架任务");
        tbProdMapper.taskOfflineProd();
        System.out.println("结束执行定时下架任务");
    }

}
